/******************************************************************************************
 * Import
 ******************************************************************************************/

// module
import Taro, { Component } from '@tarojs/taro'

// project
import { CPage, CContent, CHeader, CFooter, CFloat, CAround, CBetween, CCenter, CRow, CWrap, CLine, CHand, CItemX, CItemY, CText, CLabel, CSvg, CImage, CButton } from '../../../library/comp';
import { Base64, Gen, Time, Zip, Session, Storage, Http } from '../../../library/func';
import Icon from '../../../project/style/icon';

import DoHttp from '../../../project/func/http/http';

require("../../../assets/image/nvipcimg.png")

/******************************************************************************************
 * Export Class
 ******************************************************************************************/

export default class Index extends Component {

	/*------------------------------------------------------------------------------------
	 * 初始化
	 *-----------------------------------------------------------------------------------*/
	constructor(props) {
		super(props);

		/**
		 * state
		 */
		this.state = {
			userInfo:{},
		}
	}

	/*------------------------------------------------------------------------------------
	 * 生命周期
	 *-----------------------------------------------------------------------------------*/
	// didMount
	componentDidMount() {
		Storage.get({
			key: 'userInfo',
			success:(res)=>{
				console.log(res);
				this.setState({
					userInfo:res,
				})
			}
		});

	}
	
	/*------------------------------------------------------------------------------------
	 * 事件处理
	 *-----------------------------------------------------------------------------------*/
	// onClick
	onClick = (e)=> {
		
	}
    
    // onRedirect
    onRedirect = (url, e)=> {
        wx.redirectTo({
            url: url
        })
    }

    // onNavigate
    onNavigate = (url, e)=> {

    }

	/*------------------------------------------------------------------------------------
	 * 自定义方法
	 *-----------------------------------------------------------------------------------*/
	config = {
        navigationBarTitleText: 'vip首页',
        navigationBarBackgroundColor: '#dd2f3c',
        navigationBarTextStyle: '#fff'
    }

	/*------------------------------------------------------------------------------------
	 * 渲染
	 *-----------------------------------------------------------------------------------*/
	render () {
		return (
			<CPage>
				<CContent>

					{/* 顶部 */}
					<CRow bg='#1F1F1F' h='200' y="top">
						<CRow h="100" mt="30" y="center">
							<image style="width:150rpx; height:150rpx; border-radius: 150rpx; border:2px solid #E2BE70; margin-left:50rpx;" src={ this.state.userInfo.avatarUrl }></image>
							<text style="color:#fff; size:16px; margin-left:15px">{ this.state.userInfo.nickName }</text>
						</CRow>	
					</CRow>

					{/* vip特权介绍 */}
					<CRow bg="white" x="center"  mt="-40" rt="20">
						{/* 图片 */}
						<image style="width:96%; height:540rpx; margin-top:60rpx;" src="../../../assets/image/nvipcimg.png"/>
					</CRow>

                    {/* 提交区域 */}
                    <CItemY x="center" y="center" py="25">
						<CButton color="#fff" y="center" style="font-size:16px; font-weight:600" bg="#E7B962" h="40" px="20" ra="30"
						onClick={this.onRedirect.bind(this, '/screen/vip/normal/gift')}
						>补充资料赚积分升级VIP</CButton>
                    </CItemY>


				</CContent>

				{/* Footer */}
				<CFooter h='50' bg='#06f'>Footer</CFooter>


			</CPage>
		)
	}
}


